﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HslCommunication.Core.Net;
using Net_SCADA.Siemens;

namespace Net_SCADA
{
    public class Zone
    {
        public List<int> BindAlarmID { get; set; } = new List<int>();
        public string[] ZoneName { get; set; }
        public int ID { get; set; } = 0;
        public string EquipID { get; set; } = "";
        public int GroupID { get; set; } = 0;
        public string Unit { get; set; } = "";
        public Item pv { get; set; }
        public Item sv { get; set; }
        public Item ovpv { get; set; }
        public Item ovsv { get; set; }
        public Item ubais { get; set; }
        public Item lbais { get; set; }
        public Item diff { get; set; }
        public bool isSV { get; set; } = false;
        public int svtype { get; set; } = 1;
        public void BindingAlarm(string alarmIDs)
        {
            if (alarmIDs.Trim() == "") return;
            string[] s = alarmIDs.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < s.Length; i++)
            {
                if (int.TryParse(s[i], out int v)) BindAlarmID.Add(v);

            }
        }
        public bool isShowCurve { get {
                bool isshow=false ;
                if (pv != null) isshow = pv.isRecord || isshow;
                if (sv != null) isshow = sv.isRecord || isshow;
                if (ovpv != null) isshow = ovpv.isRecord || isshow;
                return isshow; 
            } }
        public List<Item> allItem()
        {
            return new List<Item>()
            {
                pv,sv,ovpv,ovsv,ubais,lbais,diff
            };
        }
    }
}
